<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>角色管理</title>
	<script type="text/javascript">
		$(document).ready(function() {
			layui.use('table', function(){
				let table = layui.table;
				table.init('layui-filter-table1',{
					escape : false
					,height: getLayuiTableHeight()
					,className: 'layui-table-custom'
					,done: function (res,curr,count){
					}
				});
			});
		});
	</script>
</head>
<body>
	<div class="content">
		<sys:message content="${message}"/>
		<div class="card">
			<table id="layui-table-id1" lay-filter="layui-filter-table1" style="display: none;">
				<thead>
				<tr>
					<th lay-data="{field:'numbers',type: 'numbers',align:'center',width:40, fixed: 'left'}">#</th>
					<th lay-data="{field:'id',hide:true}">ID</th>
					<th lay-data="{field:'a.name'}">角色名称</th>
					<th lay-data="{field:'a.en_name'}">英文名称</th>
					<th lay-data="{field:'a.sort',align:'center',width:40}">排序</th>
					<th lay-data="{field:'a.office_id'}">归属机构</th>
					<th lay-data="{field:'a.data_scope'}">数据范围</th>
					<shiro:hasPermission name="sys:role:edit">
						<th lay-data="{field:'opt',align:'center',width: 180,fixed:'right'}">操作</th>
					</shiro:hasPermission>
				</tr>
				</thead>
				<tbody>
				<c:forEach items="${list}" var="role">
					<tr>
						<td></td>
						<td>${role.id}</td>
						<td>${role.name}</td>
						<td>${role.enname}</td>
						<td>${role.sort}</td>
						<td>${role.office.name}</td>
						<td>${fns:getDictLabel(role.dataScope, 'sys_data_scope', '无')}</td>
						<shiro:hasPermission name="sys:role:edit">
						<td>
							<a class="btn btn-outline alpha-primary text-primary" href="${ctxAdmin}/sys/role/user4Selected?id=${role.id}">配置用户</a>
							<c:if test="${(role.sysData eq fns:getDictValue('是', 'sys_yes_no', '1') && fns:getUser().admin)||!(role.sysData eq fns:getDictValue('是', 'sys_yes_no', '1'))}">
								<a class="btn btn-outline alpha-primary text-primary" href="${ctxAdmin}/sys/role/form?id=${role.id}">修改</a>
							</c:if>
							<a class="btn btn-outline alpha-primary text-danger" onclick="confirmOperation(this,'确定要删除该角色吗？')"
							   data-url="${ctxAdmin}/sys/role/delete?id=${role.id}" >删除</a>
						</td>
						</shiro:hasPermission>
					</tr>
				</c:forEach>
				</tbody>
			</table>
		</div>
	</div>
</body>
</html>